//
//  HYCSecPushSecDisCell.m
//  FamilyTravel
//
//  Created by dllo on 15/10/24.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCSecPushSecDisCell.h"
#import <UIImageView+WebCache.h>
#import "HYCSecPushSecDisModel.h"
#define WIDTH self.contentView.frame.size.width
#define HEIFGT self.contentView.frame.size.height




@implementation HYCSecPushSecDisCell


- (void)dealloc {
    [_hotImageView release];
    [_titleLabel release];
    [_hotView release];
    [_disLabel release];
    [_moneyLabel release];
    
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}
- (void)createCell{
    
    self.hotView = [[UIView alloc] init];
    [self.contentView addSubview:self.hotView];
    [_hotView release];
    
    self.hotImageView = [[UIImageView alloc] init];
    [self.hotView addSubview:self.hotImageView];
    [_hotImageView release];
//    self.hotImageView.backgroundColor = [UIColor grayColor];

    
    self.titleLabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.numberOfLines = 0;
    [_titleLabel release];
//    self.titleLabel.backgroundColor = [UIColor yellowColor];;
    
    
    self.disLabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.disLabel];
    self.disLabel.font = [UIFont systemFontOfSize:12];
    [_disLabel release];
    self.disLabel.textColor = [UIColor redColor];
    
    self.moneyLabel = [[UILabel alloc] init];
    [self.hotView addSubview:self.moneyLabel];
    self.moneyLabel.font = [UIFont systemFontOfSize:12];
    [_moneyLabel release];
    self.moneyLabel.textColor = [UIColor redColor];
//    self.moneyLabel.backgroundColor = [UIColor yellowColor];
    

    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.hotView.frame = CGRectMake(0 , 0, WIDTH, HEIFGT);
    self.hotImageView.frame = CGRectMake(WIDTH / 75, HEIFGT / 10, WIDTH - 10, HEIFGT / 1.03448);
    self.titleLabel.frame = CGRectMake(WIDTH / 18.75, HEIFGT / 9, WIDTH / 1.25, HEIFGT / 2);
    self.disLabel.frame = CGRectMake(WIDTH / 18.75, HEIFGT / 1.2, WIDTH / 10.714, HEIFGT / 9);
    self.moneyLabel.frame = CGRectMake(WIDTH / 1.4, HEIFGT / 1.2, WIDTH / 4, HEIFGT / 9);
    
}


#pragma mark -  Setter Method
- (void)setModel:(HYCSecPushSecDisModel *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
        
        [_hotImageView sd_setImageWithURL:[NSURL URLWithString:_model.photo]placeholderImage:[UIImage imageNamed:@"zw.png"]];
        
        _titleLabel.text = _model.title;
        _disLabel.text = _model.priceoff;
        
        NSString *str = [_model.price stringByReplacingOccurrencesOfString:@"<em>" withString:@""];
        NSString *str1 = [str stringByReplacingOccurrencesOfString:@"</em>" withString:@""];
        
        _moneyLabel.text = str1;
    
    }
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
